import time

from selenium.webdriver.common.by import By

from base.page_base import BasePage


class ReviewPage(BasePage):
    def __init__(self, driver):
        super().__init__(driver)
        self.a = By.XPATH, '/html/body/div[1]/div[2]/ul/li[2]/a'
        self.b = By.XPATH, '//*[@id="sidebar"]/ul/li[5]/a/span'
        self.c = By.XPATH, '//*[@id="sidebar"]/ul/li[5]/ul/li[2]/a'
        self.frame = (By.XPATH, '//*[@id="iframe_box"]')
        self.d = By.XPATH, '/html/body/div[2]/div[1]/div/ul/li[1]/div/input'
        self.e = By.XPATH, '/html/body/div[2]/div[1]/div/ul/li[3]/input'
        self.f = By.XPATH, '/html/body/div[2]/div[3]/table/tbody/tr[1]'
        self.g = By.XPATH, '/html/body/div[2]/div[2]/ul/li[1]/a/span'
        self.frame1 = (By.XPATH, '//*[@id="xubox_iframe1"]')
        self.h = By.XPATH,'/html/body/div[2]/form/table/tbody/tr[5]/td[2]/div/label[1]/span'
        self.i = By.XPATH, '/html/body/div[2]/form/table/tbody/tr[6]/td[2]/div/textarea'
        self.j = By.XPATH, '/html/body/div[2]/form/table/tbody/tr[7]/td[2]/div/ul/li[1]/input'
        self.k = By.XPATH, '/html/body/div[2]/form/table/tbody/tr[8]/td[2]/input[1]'


    def review(self):
        self.base_click(self.a)
        self.base_click(self.b)
        self.base_click(self.c)
    def review_search(self,phone):
        self.base_switch_frame(self.frame)
        self.base_input(self.d,phone)
        self.base_click(self.e)
        time.sleep(1)
        self.base_click(self.f)
        self.base_click(self.g)
    def review_result(self,I='审核通过',J='8888'):
        time.sleep(1)
        self.base_switch_frame(self.frame1)
        self.base_click(self.h)
        self.base_input(self.i,I)
        self.base_input(self.j,J)
        self.base_click(self.k)

